﻿#region Usings

using System;
using System.Runtime.Serialization;

#endregion

namespace Rail.Net.Core.Model.Nonpersistent
{
    [Serializable]
    [DataContract]
    public class DistanceModel
    {
        public DistanceModel()
        {
            DistanceP81 = 0;
            DistanceMav = 0;
            DistanceP80 = 0;
            DistanceP60 = 0;
            DistanceP53 = 0;
            DistanceP52 = 0;
            DistanceP51 = 0;
            DistanceP50 = 0;
            DistanceP43 = 0;
            DistanceP42 = 0;
            DistanceP41 = 0;
            DistanceP40 = 0;
            DistanceP31 = 0;
            DistanceP30 = 0;
            DistanceP20 = 0;
            DistanceP10 = 0;
            DistanceSbb = 0;
            DistanceDb = 0;
            DistanceOebb = 0;

            TarifType = DomesticTarifType.FullPrice;
        }

        [DataMember]
        public DomesticTarifType TarifType { get; set; }

        public int DistanceKmSum
        {
            get
            {
                return DistanceOebb + DistanceDb + DistanceSbb + DistanceP10 + DistanceP20 + DistanceP30 + DistanceP31 +
                       DistanceP40 + DistanceP41 + DistanceP42 + DistanceP43 + DistanceP50 + DistanceP51 + DistanceP52 +
                       DistanceP53 + DistanceP60 + DistanceP80 + DistanceMav + DistanceP81;
            }
        }

        public int DistanceKmSpecific
        {
            get
            {
                var distanceKmSpecific = 0;
                if (TarifType == DomesticTarifType.Businesscard || TarifType == DomesticTarifType.BusinesscardBonus)
                {
                    distanceKmSpecific += DistanceP60;
                    distanceKmSpecific += DistanceP80;
                }
                if (TarifType == DomesticTarifType.Minimax || TarifType == DomesticTarifType.MinimaxVc)
                {
                    distanceKmSpecific += DistanceP20;
                    distanceKmSpecific += DistanceP31;
                }
                return distanceKmSpecific;
            }
        }

        [DataMember]
        public int DistanceOebb { get; set; }

        [DataMember]
        public int DistanceDb { get; set; }

        [DataMember]
        public int DistanceSbb { get; set; }

        [DataMember]
        public int DistanceP10 { get; set; }

        [DataMember]
        public int DistanceP20 { get; set; }

        [DataMember]
        public int DistanceP30 { get; set; }

        [DataMember]
        public int DistanceP31 { get; set; }

        [DataMember]
        public int DistanceP40 { get; set; }

        [DataMember]
        public int DistanceP41 { get; set; }

        [DataMember]
        public int DistanceP42 { get; set; }

        [DataMember]
        public int DistanceP43 { get; set; }

        [DataMember]
        public int DistanceP50 { get; set; }

        [DataMember]
        public int DistanceP51 { get; set; }

        [DataMember]
        public int DistanceP52 { get; set; }

        [DataMember]
        public int DistanceP53 { get; set; }

        [DataMember]
        public int DistanceP60 { get; set; }

        [DataMember]
        public int DistanceP80 { get; set; }

        [DataMember]
        public int DistanceMav { get; set; }

        [DataMember]
        public int DistanceP81 { get; set; }
    }
}